#ifndef PRODUCTMODEL_H
#define PRODUCTMODEL_H

#include <QObject>
#include <QAbstractListModel>
#include "database/databasequery.h"

class ProductModel:public QAbstractListModel
{
public:
    ProductModel(int colCnt,const QString& showName,QObject* parent);
    ~ProductModel();
    enum {
        ROLE_NAME = Qt::UserRole,
        ROLE_HI,
        ROLE_OK,
        ROLE_LOW
    };
    QString getTabName(){return mTabName;}

public slots:
    virtual bool submit();
    virtual bool submitFilter(const QString &str);

    // QAbstractItemModel interface
public:
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
private:
    DataBaseQuery *mQuery;
    int mColumnCount;
    int mDataCount;
    QString mColumnName;
    QString mTabName;
};

#endif // PRODUCTMODEL_H
